Skip to content

Conversation

@stevhliu
Copy link
Member

Adds docs for how to enable checks when using different attention backends

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@stevhliu stevhliu requested a review from sayakpaul October 15, 2025 00:20
Comment on lines +104 to +112
try:
with attention_backend("flash"):
output = dispatch_attention_fn(query, key, value)
print("✓ Flash Attention works with checks enabled")
except Exception as e:
print(f"✗ Flash Attention failed: {e}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be set as export DIFFUSERS_ATTN_CHECKS=yes before running any execution because of how DIFFUSERS_ATTN_CHECKS is used:

from ..utils.constants import DIFFUSERS_ATTN_BACKEND, DIFFUSERS_ATTN_CHECKS, DIFFUSERS_ENABLE_HUB_KERNELS

DIFFUSERS_ATTN_CHECKS = os.getenv("DIFFUSERS_ATTN_CHECKS", "0") in ENV_VARS_TRUE_VALUES

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah DIFFUSERS_ATTN_CHECKS is determined at the module-level so I am not sure setting it that way would be effective.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, updated to use export DIFFUSERS_ATTN_CHECKS=yes then!

@stevhliu stevhliu merged commit 2647508 into huggingface:main Oct 16, 2025
1 check passed
@stevhliu stevhliu deleted the checks branch October 16, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants